#ifndef DESKTOP_H
#define DESKTOP_H

#include <QGraphicsObject>
#include <QPropertyAnimation>
#include "gui.h"

class DesktopResource;

class Desktop : public GUI
{
    Q_OBJECT
    Q_PROPERTY(qreal index READ index WRITE setIndex)
public:
    Desktop(GUI *g, int w, int h);

    qreal index() const { return m_index; }
    void setIndex(qreal index);

    void change(int delta);
    // GUI
    void select();
    void left();
    void right();

protected:
    QRectF boundingRect() const;
    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
    void keyPressEvent(QKeyEvent *event);

private:
    void setup();

private:
    DesktopResource *m_resource;
    GUI *m_gui;
    int m_width;
    int m_height;
    QPixmap *m_backgroundPixmap;

    qreal m_index;
    QList<QPixmap *> *m_appsPixmap;
    QList<QGraphicsItem *> m_apps;
    QPropertyAnimation m_animation;
};

#endif // DESKTOP_H
